SELECT COUNT(1)
FROM FD_VARIABLE T
JOIN FD_DICTIONARY JD ON (JD.ID = T.TYPE_ID)
WHERE 1 = 1
<#if (TYPE_ID!) != ''>
AND T.TYPE_ID = :TYPE_ID
</#if>
<#if (CODE!) != ''>
AND (INSTR(T.CODE, :CODE)  > 0
OR INSTR(T.NAME, :CODE)    > 0)
</#if>